﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web.Services;
using Medianamik.Core.CodeGeneration;
using Medianamik.Core;
using Medianamik.Core.Configuration;
using Medianamik.Core.Logging;

namespace Medianamik.UI.Services
{
    [WebService(Namespace = "http://absolunet.com/medianamik/webservices/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class TypeManagementService : WebService
    {
        private static readonly ILogger Logger = new ObjectFactory<ILogger>()
            .Get("MaintenanceServiceLogger");

        static List<String> PROPERTY_GROUP_NAMES = NodeTypeManager.GetPropertyGroupNames();

        private static readonly MedianamikConfigSection Config = 
            (MedianamikConfigSection)ConfigurationManager
            .GetSection(ConfigurationSectionName.MEDIANAMIK);

        [WebMethod]
        public String[] GetPropertyGroupNames(string prefixText, int count)
        {
            return PROPERTY_GROUP_NAMES.FindAll(delegate(String p)
            { return p.StartsWith(prefixText, StringComparison.OrdinalIgnoreCase); }
                ).ToArray();
        }
    }
}
